﻿using Chaotic.DataBase.DBAccessLibrary.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace Chaotic.Module.DBTool.TemplateSelectors
{
    public class ImageDataTemplateSelector : DataTemplateSelector
    {
        public DataTemplate ImageDataTemplate { get; set; }
        public DataTemplate GlyphDataTemplate { get; set; }
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (item is FieldStatus status)
            {
                if (!string.IsNullOrEmpty(status.ImageUrl))
                {
                    return ImageDataTemplate;
                }
                else if (!string.IsNullOrEmpty(status.Glyph))
                {
                    return GlyphDataTemplate;
                }
            }
            return null;
        }
    }
}
